<?php

class Model_nilai extends CI_Model {

    function getDaftarNilai($id) {
        $q = $this->db->query("SELECT s.nim, s.nama, s.kelas, n.benar, n.salah, n.nilai, n.lama_pengerjaan
FROM nilai n, siswa s
WHERE n.id_siswa = s.id AND n.id_soal = $id
ORDER BY s.kelas ASC");
        return $q->result();
    }
    
    function nilaiSiswa($id_siswa) {
        $q = $this->db->query("SELECT s.materi, n.benar, n.salah, n.nilai 
FROM nilai n
INNER JOIN soal s
ON s.id = n.id_soal
WHERE n.id_siswa = $id_siswa");
        return $q->result();
    }

}

?>
